import type { FormSchema } from '@/components/core/schema-form/';
import { UploadOutlined } from '@ant-design/icons-vue';

export const useFormSortSchema = (): FormSchema<API.CreateOrgParams>[] => [
  {
    field: 'name',
    component: 'Input',
    label: '机构名称',
    rules: [{ required: true, type: 'string' }],
  },
  {
    field: 'code',
    component: 'Input',
    label: '机构编码',
    rules: [{ required: true, type: 'string' }],
  },
  {
    field: 'orgType',
    component: 'Input',
    label: '机构类型',
  },
  {
    field: 'parentId',
    component: 'TreeSelect',
    label: '上级机构',
    componentProps: {
      fieldNames: {
        label: 'NAME',
        value: 'ID',
      },
      getPopupContainer: () => document.body,
    },
    rules: [{ required: true, type: 'string' }],
  },
  {
    field: 'leader',
    component: 'Input',
    label: '机构领导',
  },
  {
    field: 'parentLeader',
    component: 'Input',
    label: '上级机构领导',
  },
  {
    field: 'phoneNumber',
    component: 'Input',
    label: '联系电话',
  },
  {
    field: 'picture',
    component: 'Upload',
    // label: '审核附件',
    colProps: {
      span: 12,
    },
    componentProps: {
      maxCount: 1,
      action: '/api/',//上传地址
      listType:"picture-card"//图片样式
    },
    componentSlots: {
      default: () => (
        <span>
          <UploadOutlined /> 点击上传
        </span>
      ),
    },
    label: '机构图片',

  },
  {
    field: 'isLegalPerson',
    component: 'RadioGroup',
    label: '是否法人机构',
    defaultValue: 0,
    componentProps: {
      options: [
        {
          label: '否',
          value: 0,
        },
        {
          label: '是',
          value: 1,
        },
      ],
    },
  },
  {
    field: 'operationCode',
    component: 'Input',
    label: '营业编码',
  },
  {
    field: 'orgNetAddress',
    component: 'Input',
    label: '机构网址',
  },
  {
    field: 'orgAddress',
    component: 'Input',
    label: '机构地址',
  },
  {
    field: 'IS_ENABLED',
    component: 'RadioGroup',
    label: '是否启用',
    defaultValue: 1,
    componentProps: {
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 0,
        },
      ],
    },
  },
  {
    field: 'IS_BUSINESS',
    component: 'RadioGroup',
    label: '是否与业务相关',
    defaultValue: 0,
    componentProps: {
      options: [
        {
          label: '是',
          value: 1,
        },
        {
          label: '否',
          value: 0,
        },
      ],
    },
  },
  {
    field: 'orgTags',
    component: 'Input',
    label: '机构标签',
  },
  {
    field: 'keyWords',
    component: 'Input',
    label: '关键字',
    rules: [{ required: true, type: 'string' }],
  },
  {
    field: 'orgSort',
    component: 'Input',
    label: '排序号',
  },
  {
    field: 'remark',
    component: 'InputTextArea',
    label: '备注',
  },
];
type blankDataType=API.CreateOrgParams;
export const orgBlankData:blankDataType={
    /**
         * 组织ID
         */
    id: '',
    /**
     * 上级机构ID
     */
    parentId: '',
    /**
     * 机构类型
     */
    orgType: '',
    /**
     * 机构名称
     */
    name: '',
    /**
     * 机构编码
     */
    code: '',
    /**
     * 机构领导
     */
    leader: '',
    /**
     * 上级机构领导
     */
    parentLeader: '',
    /**
     * 联系电话
     */
    phoneNumber: '',
    /**
     * 机构图片
     */
    picture: '',
    /**
     * 是否法人机构
     */
    isLegalPerson: undefined,
    /**
     * 营业编码
     */
    operationCode: '',
    /**
     * 关键字
     */
    keyWords: '',
    /**
     * 机构网址
     */
    orgNetAddress: '',
    /**
     * 机构地址
     */
    orgAddress: '',
    /**
     * 是否启用
     */
    IS_ENABLED: undefined,
    /**
     * 是否业务相关
     */
    IS_BUSINESS: undefined,
    /**
     * 机构标签
     */
    orgTags: '',
    /**
     * 排序号
     */
    orgSort: undefined,
    /**
     * 备注
     */
    remark: '',
};

